<?php
/**
 * Description of admin controller
 * Manages all the content on the site
 *
 * @author dmitryy
 */
class Controller_Admin extends Controller_Action {
    function index() {
        $this->registry->get('view')->show('adminmenu');
    }
    
    function show($item)
    {
        switch ($item) {
            case 'tree':
                $this->registry->get('view')->show('admin');
                break;
            case 'top':
                $this->registry->get('view')->show('admintop');
                break;
            case 'comments':
                $this->registry->get('view')->show('admincomments');
                break;
            case 'commentsall':
                $this->registry->get('view')->show('admincommentsall');
                break;
            case 'users':
                $this->registry->get('view')->show('adminusers');
                break;
            case 'newusers':
                $this->registry->get('view')->show('newusers');
                break;
            case 'tags':
                $this->registry->get('view')->show('tags');
                break;
            case 'roles':
                $this->registry->get('view')->show('roles');
                break;
            default:
                echo "<div class=\"alert alert-danger\"><h4><u>$item</u> not found.</h4></div>";
                break;
        }
    }
    
    function commentok($id)
    {
        $this->registry->get('view')->set('id',$id);
        $this->registry->get('view')->show('commentok');
    }
    
    function commentremove($id)
    {
         $this->registry->get('view')->set('id',$id);
         $this->registry->get('view')->show('commentremove');
    }
    
    function activateuser($id)
    {
        $this->registry->get('view')->set('id',$id);
        $this->registry->get('view')->show('activateuser');
    }
    
    function removeuser($id)
    {
        $this->registry->get('view')->set('id',$id);
        $this->registry->get('view')->show('removeuser');
    }
    
    function edituserrole($id)
    {
        $this->registry->get('view')->set('id',$id);
        $this->registry->get('view')->show('edituserrole');
    }
    
    function addtag()
    {
        $this->registry->get('view')->show('addtag');
    }
    
    function help()
    {
        $this->registry->get('view')->show('adminhelp');
    }
    
    function addrole()
    {
        $this->registry->get('view')->show('addrole');
    }
    
    function addingrole()
    {
        $this->registry->get('view')->show('addingrole');
    }
    function permissions($id)
    {
        $this->registry->get('view')->set('id',$id);
        $this->registry->get('view')->show('permissions');
    }
}